import type { APIGetUserInfoReqData, APIUserInfo } from '@/types/api/user'
import { getUserInfo } from '../entities/user'

export class UserModel {
  protected isMock = false
  // 查询用户信息
  async getUserInfo(params: APIGetUserInfoReqData): Promise<APIUserInfo> {
    if (this.isMock) {
      return {
        mobile: params.mobile,
        gwj: '100.00',
      }
    }
    const resp = await getUserInfo(params)
    if (resp.isSuccess) {
      return resp.data
    }
    throw new Error(resp.message)
  }
}
